#include "Bullet.h"


Bullet::Bullet(int xpos, int ypos,int * scrollx, int * scrolly, int direct)
{
	direction = direct;
	this->scrollx = scrollx;
	this->scrolly = scrolly;
	x = xpos;
	y = ypos;
	lifetime = 0;

	if(direct == 0)
	{
		speed = MAXSPEED;
	}
	else
	{
		speed = -MAXSPEED;
	}
	pic = al_create_bitmap(160,18);
	al_set_target_bitmap(pic);
	ALLEGRO_FONT *font18 = al_load_font("SF Theramin Gothic.ttf", 18, 0);
	al_clear_to_color(al_map_rgb(255,0,255));
	al_draw_text(font18, al_map_rgb(0,255,0), 0, 0, 0, ">Implication");
	al_convert_mask_to_alpha(pic,al_map_rgb(255,0,255));
}

int Bullet::draw(ALLEGRO_DISPLAY ** display)
{
	x += speed;
	al_set_target_bitmap(al_get_backbuffer(display[0]));
	al_draw_bitmap(pic,x-scrollx[0],y-scrolly[0],0);
	lifetime++;
	if(lifetime > 100)
	{
		return -1;
	}
	return 0;
}


Bullet::~Bullet()
{

}